6.1.5 Circles (circle)
1. Definition
An instance C of the data type circle is a circle in the two-dimensional
plane, i.e., the set of points having a certain distance r from a given
point p. r is called the radius and p is called the center of C.
The circle with center (0, 0) and radius 0 is called the empty circle.
2. Creation
a) C (point p, double r)
b) C (double x, double y, double r)
c) C
introduces a variable C of type circle. C is initialized to the circle
with center p and radius r (variant a), to the circle with center (x, y)
and radius r (variant b), or to the empty circle (variant c).
3. Operations
& truecm & truecm &
double radius
returns the radius of .
point center
returns the center of .
listpoint intersection line l
returns C∩l as a list of points.
listpoint intersection segment s
returns C∩s as a list of points.
listpoint intersection circle D
returns C∩D as a list of points.
segment left_tangent point p
returns the line segment starting in p tangent
to and left of segment
[p, C.center()].
segment right_tangent point p
returns the line segment starting in p tangent
to and right of segment
[p, C.center()].
double distance point p
returns the distance between and p
(negative if p inside ).
double distance line l
returns the distance between and l
(negative if l intersects ).
double distance circle D
returns the distance between and D
(negative if D intersects ).
bool inside point p
returns true if P lies inside of ,
false otherwise.
bool outside point p
returns !.inside(p).
circle translate vector v
returns C + v, i.e., the circle created by
translating C by vector v.
v.dim = 2.
circle translate double &alpha#alpha;, double d
returns the circle created by a translation of
C in direction α by distance d.
circle rotate point q, double &alpha#alpha;
returns the circle created by a rotation of C
about point q by angle α.
4. Operators
&bool &circle == circle &test for equality
&bool &circle != circle &test for inequality